<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Visuals</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
<link rel="home" href="index.html" title="GDK参考手册">
<link rel="up" href="reference.html" title="API参考">
<link rel="prev" href="gdk-Colormaps-and-Colors.html" title="Colormaps and Colors">
<link rel="next" href="gdk-Fonts.html" title="Fonts">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gdk-Colormaps-and-Colors.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GDK参考手册</th>
<td><a accesskey="n" href="gdk-Fonts.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#gdk-Visuals.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#gdk-Visuals.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="gdk-Visuals"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="gdk-Visuals.top_of_page"></a>Visuals</span></h2>
<p>Visuals — Low-level display hardware information</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="gdk-Visuals.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;gdk/gdk.h&gt;

                    <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual">GdkVisual</a>;
enum                <a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType">GdkVisualType</a>;
enum                <a class="link" href="gdk-Visuals.html#GdkByteOrder" title="enum GdkByteOrder">GdkByteOrder</a>;
<span class="returnvalue">void</span>                <a class="link" href="gdk-Visuals.html#gdk-query-depths" title="gdk_query_depths ()">gdk_query_depths</a>                    (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> **depths</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *count</code></em>);
<span class="returnvalue">void</span>                <a class="link" href="gdk-Visuals.html#gdk-query-visual-types" title="gdk_query_visual_types ()">gdk_query_visual_types</a>              (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> **visual_types</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *count</code></em>);
<a href="../glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *             <a class="link" href="gdk-Visuals.html#gdk-list-visuals" title="gdk_list_visuals ()">gdk_list_visuals</a>                    (<em class="parameter"><code><span class="type">void</span></code></em>);
<a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-depth" title="gdk_visual_get_best_depth ()">gdk_visual_get_best_depth</a>           (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="returnvalue">GdkVisualType</span></a>       <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-type" title="gdk_visual_get_best_type ()">gdk_visual_get_best_type</a>            (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-system" title="gdk_visual_get_system ()">gdk_visual_get_system</a>               (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-best" title="gdk_visual_get_best ()">gdk_visual_get_best</a>                 (<em class="parameter"><code><span class="type">void</span></code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-depth" title="gdk_visual_get_best_with_depth ()">gdk_visual_get_best_with_depth</a>      (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> depth</code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-type" title="gdk_visual_get_best_with_type ()">gdk_visual_get_best_with_type</a>       (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> visual_type</code></em>);
<a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-both" title="gdk_visual_get_best_with_both ()">gdk_visual_get_best_with_both</a>       (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> depth</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> visual_type</code></em>);
#define             <a class="link" href="gdk-Visuals.html#gdk-visual-ref" title="gdk_visual_ref()">gdk_visual_ref</a>                      (v)
#define             <a class="link" href="gdk-Visuals.html#gdk-visual-unref" title="gdk_visual_unref()">gdk_visual_unref</a>                    (v)
<a class="link" href="GdkScreen.html" title="GdkScreen"><span class="returnvalue">GdkScreen</span></a> *         <a class="link" href="gdk-Visuals.html#gdk-visual-get-screen" title="gdk_visual_get_screen ()">gdk_visual_get_screen</a>               (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> *visual</code></em>);
</pre>
</div>
<div class="refsect1">
<a name="gdk-Visuals.description"></a><h2>Description</h2>
<p>
A <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> describes a particular video hardware display format. It includes
information about the number of bits used for each color, the way the bits are
translated into an RGB value for display, and the way the bits are stored in
memory. For example, a piece of display hardware might support 24-bit color,
16-bit color, or 8-bit color; meaning 24/16/8-bit pixel sizes. For a given
pixel size, pixels can be in different formats; for example the "red" element
of an RGB pixel may be in the top 8 bits of the pixel, or may be in the lower
4 bits.
</p>
<p>
Usually you can avoid thinking about visuals in GTK+. Visuals are useful to
interpret the contents of a <a class="link" href="gdk-Images.html#GdkImage" title="GdkImage"><span class="type">GdkImage</span></a>, but you should avoid <a class="link" href="gdk-Images.html#GdkImage" title="GdkImage"><span class="type">GdkImage</span></a> precisely
because its contents depend on the display hardware; use <a href="../gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf"><span class="type">GdkPixbuf</span></a> instead, for
all but the most low-level purposes. Also, anytime you provide a <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>,
the visual is implied as part of the colormap (<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-get-visual" title="gdk_colormap_get_visual ()"><code class="function">gdk_colormap_get_visual()</code></a>), so
you won't have to provide a visual in addition.
</p>
<p>
There are several standard visuals. The visual returned
by <a class="link" href="gdk-Visuals.html#gdk-visual-get-system" title="gdk_visual_get_system ()"><code class="function">gdk_visual_get_system()</code></a> is the system's default
visual. <a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-visual" title="gdk_rgb_get_visual ()"><code class="function">gdk_rgb_get_visual()</code></a> return the visual most
suited to displaying full-color image data. If you
use the calls in <span class="type">GdkRGB</span>, you should create your windows
using this visual (and the colormap returned by
<a class="link" href="gdk-GdkRGB.html#gdk-rgb-get-colormap" title="gdk_rgb_get_colormap ()"><code class="function">gdk_rgb_get_colormap()</code></a>).
</p>
<p>
A number of functions are provided for determining
the "best" available visual. For the purposes of
making this determination, higher bit depths are
considered better, and for visuals of the same
bit depth, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a> is preferred at
8bpp, otherwise, the visual types are ranked in the
order of (highest to lowest) <a class="link" href="gdk-Visuals.html#GDK-VISUAL-DIRECT-COLOR:CAPS"><code class="literal">GDK_VISUAL_DIRECT_COLOR</code></a>,
<a class="link" href="gdk-Visuals.html#GDK-VISUAL-TRUE-COLOR:CAPS"><code class="literal">GDK_VISUAL_TRUE_COLOR</code></a>, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a>,
<a class="link" href="gdk-Visuals.html#GDK-VISUAL-STATIC-COLOR:CAPS"><code class="literal">GDK_VISUAL_STATIC_COLOR</code></a>, <a class="link" href="gdk-Visuals.html#GDK-VISUAL-GRAYSCALE:CAPS"><code class="literal">GDK_VISUAL_GRAYSCALE</code></a>,
then <a class="link" href="gdk-Visuals.html#GDK-VISUAL-STATIC-GRAY:CAPS"><code class="literal">GDK_VISUAL_STATIC_GRAY</code></a>.
</p>
</div>
<div class="refsect1">
<a name="gdk-Visuals.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="GdkVisual"></a><h3>GdkVisual</h3>
<pre class="programlisting">typedef struct {
  GObject parent_instance;
  
  GdkVisualType type;
  gint depth;
  GdkByteOrder byte_order;
  gint colormap_size;
  gint bits_per_rgb;

  guint32 red_mask;
  gint red_shift;
  gint red_prec;

  guint32 green_mask;
  gint green_shift;
  gint green_prec;

  guint32 blue_mask;
  gint blue_shift;
  gint blue_prec;
} GdkVisual;
</pre>
<p>
The <span class="type">GdkVisual</span> structure contains information about
a particular visual.
</p>
<div class="example">
<a name="rgbmask"></a><p class="title"><b>Example 5. Constructing a pixel value from components</b></p>
<div class="example-contents"><pre class="programlisting">
guint
pixel_from_rgb (GdkVisual *visual,
                guchar r, guchar b, guchar g)
{
  return ((r &gt;&gt; (16 - visual-&gt;red_prec))   &lt;&lt; visual-&gt;red_shift) |
         ((g &gt;&gt; (16 - visual-&gt;green_prec)) &lt;&lt; visual-&gt;green_shift) |
         ((r &gt;&gt; (16 - visual-&gt;blue_prec))  &lt;&lt; visual-&gt;blue_shift);
}
</pre></div>
</div>
<br class="example-break"><div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><a href="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a> <em class="structfield"><code><a name="GdkVisual.parent-instance"></a>parent_instance</code></em>;</span></p></td>
<td>inherited portion from <a href="../gobject/gobject-The-Base-Object-Type.html#GObject"><span class="type">GObject</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> <em class="structfield"><code><a name="GdkVisual.type"></a>type</code></em>;</span></p></td>
<td>The type of this visual.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.depth"></a>depth</code></em>;</span></p></td>
<td>The number of bits per pixel.</td>
</tr>
<tr>
<td><p><span class="term"><a class="link" href="gdk-Visuals.html#GdkByteOrder" title="enum GdkByteOrder"><span class="type">GdkByteOrder</span></a> <em class="structfield"><code><a name="GdkVisual.byte-order"></a>byte_order</code></em>;</span></p></td>
<td>The byte-order for this visual.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.colormap-size"></a>colormap_size</code></em>;</span></p></td>
<td>The number of entries in the colormap, for
visuals of type <a class="link" href="gdk-Visuals.html#GDK-VISUAL-PSEUDO-COLOR:CAPS"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></a> or
<code class="literal">GDK_VISUAL_GRAY_SCALE</code>. For other visual types, it
is the number of possible levels per color component.
If the visual has different numbers of levels for
different components, the value of this field is undefined.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.bits-per-rgb"></a>bits_per_rgb</code></em>;</span></p></td>
<td>The number of significant bits per red, green, or blue
when specifying colors for this visual. (For instance, for
<a class="link" href="gdk-Colormaps-and-Colors.html#gdk-colormap-alloc-color" title="gdk_colormap_alloc_color ()"><code class="function">gdk_colormap_alloc_color()</code></a>)</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> <em class="structfield"><code><a name="GdkVisual.red-mask"></a>red_mask</code></em>;</span></p></td>
<td>A mask giving the bits in a pixel value that
correspond to the red field. Significant only for
<code class="literal">GDK_VISUAL_PSEUDOCOLOR</code> and <code class="literal">GDK_VISUAL_DIRECTCOLOR</code>.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.red-shift"></a>red_shift</code></em>;</span></p></td>
<td>The <em class="structfield"><code>red_shift</code></em> and
<em class="structfield"><code>red_prec</code></em> give an alternate presentation
of the information in <em class="structfield"><code>red_mask</code></em>.
<em class="structfield"><code>red_mask</code></em> is a contiguous sequence
of <em class="structfield"><code>red_prec</code></em> bits starting at bit
number <em class="structfield"><code>red_shift</code></em>. For example,
<a class="xref" href="gdk-Visuals.html#rgbmask" title="Example 5. Constructing a pixel value from components">Example 5, “Constructing a pixel value from components”</a> shows constructing a pixel value
out of three 16 bit color values.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.red-prec"></a>red_prec</code></em>;</span></p></td>
<td>See above.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> <em class="structfield"><code><a name="GdkVisual.green-mask"></a>green_mask</code></em>;</span></p></td>
<td>A mask giving the bits in a pixel value that
correspond to the green field.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.green-shift"></a>green_shift</code></em>;</span></p></td>
<td>The <em class="structfield"><code>green_shift</code></em> and
<em class="structfield"><code>green_prec</code></em> give an alternate presentation
of the information in <em class="structfield"><code>green_mask</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.green-prec"></a>green_prec</code></em>;</span></p></td>
<td>See above.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#guint32"><span class="type">guint32</span></a> <em class="structfield"><code><a name="GdkVisual.blue-mask"></a>blue_mask</code></em>;</span></p></td>
<td>A mask giving the bits in a pixel value that
correspond to the blue field.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.blue-shift"></a>blue_shift</code></em>;</span></p></td>
<td>The <em class="structfield"><code>blue_shift</code></em> and
<em class="structfield"><code>blue_prec</code></em> give an alternate presentation
of the information in <em class="structfield"><code>blue_mask</code></em>.</td>
</tr>
<tr>
<td><p><span class="term"><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> <em class="structfield"><code><a name="GdkVisual.blue-prec"></a>blue_prec</code></em>;</span></p></td>
<td>See above.</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkVisualType"></a><h3>enum GdkVisualType</h3>
<pre class="programlisting">typedef enum
{
  GDK_VISUAL_STATIC_GRAY,
  GDK_VISUAL_GRAYSCALE,
  GDK_VISUAL_STATIC_COLOR,
  GDK_VISUAL_PSEUDO_COLOR,
  GDK_VISUAL_TRUE_COLOR,
  GDK_VISUAL_DIRECT_COLOR
} GdkVisualType;
</pre>
<p>
A set of values that describe the manner in which the
pixel values for a visual are converted into RGB
values for display.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-VISUAL-STATIC-GRAY:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_STATIC_GRAY</code></span></p></td>
<td>Each pixel value indexes a grayscale value directly.
</td>
</tr>
<tr>
<td><p><a name="GDK-VISUAL-GRAYSCALE:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_GRAYSCALE</code></span></p></td>
<td>Each pixel is an index into a color map that maps pixel 
   values into grayscale values. The color map can be changed by an application.
</td>
</tr>
<tr>
<td><p><a name="GDK-VISUAL-STATIC-COLOR:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_STATIC_COLOR</code></span></p></td>
<td>Each pixel value is an index into a predefined,
   unmodifiable color map that maps pixel values into RGB values.
</td>
</tr>
<tr>
<td><p><a name="GDK-VISUAL-PSEUDO-COLOR:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_PSEUDO_COLOR</code></span></p></td>
<td>Each pixel is an index into a color map that maps
   pixel values into rgb values. The color map can be changed by an application.
</td>
</tr>
<tr>
<td><p><a name="GDK-VISUAL-TRUE-COLOR:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_TRUE_COLOR</code></span></p></td>
<td>Each pixel value directly contains red, green,
   and blue components. The <em class="structfield"><code>red_mask</code></em>,
   <em class="structfield"><code>green_mask</code></em>, and
   <em class="structfield"><code>blue_mask</code></em> fields of the <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a>
   structure describe how the components are assembled into a pixel value.
</td>
</tr>
<tr>
<td><p><a name="GDK-VISUAL-DIRECT-COLOR:CAPS"></a><span class="term"><code class="literal">GDK_VISUAL_DIRECT_COLOR</code></span></p></td>
<td>Each pixel value contains red, green, and blue
   components as for <a class="link" href="gdk-Visuals.html#GDK-VISUAL-TRUE-COLOR:CAPS"><code class="literal">GDK_VISUAL_TRUE_COLOR</code></a>, but the components are mapped via a
   color table into the final output table instead of being converted directly.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="GdkByteOrder"></a><h3>enum GdkByteOrder</h3>
<pre class="programlisting">typedef enum
{
  GDK_LSB_FIRST,
  GDK_MSB_FIRST
} GdkByteOrder;
</pre>
<p>
A set of values describing the possible byte-orders
for storing pixel values in memory.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><a name="GDK-LSB-FIRST:CAPS"></a><span class="term"><code class="literal">GDK_LSB_FIRST</code></span></p></td>
<td>The values are stored with the least-significant byte
  first. For instance, the 32-bit value 0xffeecc would be stored
  in memory as 0xcc, 0xee, 0xff, 0x00.
</td>
</tr>
<tr>
<td><p><a name="GDK-MSB-FIRST:CAPS"></a><span class="term"><code class="literal">GDK_MSB_FIRST</code></span></p></td>
<td>The values are stored with the most-significant byte
first. For instance, the 32-bit value 0xffeecc would be stored
in memory as 0x00, 0xcc, 0xee, 0xff.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-query-depths"></a><h3>gdk_query_depths ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_query_depths                    (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> **depths</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *count</code></em>);</pre>
<p>
This function returns the available bit depths for the default
screen. It's equivalent to listing the visuals
(<a class="link" href="gdk-Visuals.html#gdk-list-visuals" title="gdk_list_visuals ()"><code class="function">gdk_list_visuals()</code></a>) and then looking at the depth field in each
visual, removing duplicates.
</p>
<p>
The array returned by this function should not be freed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>depths</code></em> :</span></p></td>
<td>return location for available depths</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
<td>return location for number of available depths</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-query-visual-types"></a><h3>gdk_query_visual_types ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>                gdk_query_visual_types              (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> **visual_types</code></em>,
                                                         <em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> *count</code></em>);</pre>
<p>
This function returns the available visual types for the default
screen. It's equivalent to listing the visuals
(<a class="link" href="gdk-Visuals.html#gdk-list-visuals" title="gdk_list_visuals ()"><code class="function">gdk_list_visuals()</code></a>) and then looking at the type field in each
visual, removing duplicates.
</p>
<p>
The array returned by this function should not be freed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>visual_types</code></em> :</span></p></td>
<td>return location for the available visual types</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>count</code></em> :</span></p></td>
<td>return location for the number of available visual types</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-list-visuals"></a><h3>gdk_list_visuals ()</h3>
<pre class="programlisting"><a href="../glib/glib-Doubly-Linked-Lists.html#GList"><span class="returnvalue">GList</span></a> *             gdk_list_visuals                    (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Lists the available visuals for the default screen.
(See <a class="link" href="GdkScreen.html#gdk-screen-list-visuals" title="gdk_screen_list_visuals ()"><code class="function">gdk_screen_list_visuals()</code></a>)
A visual describes a hardware image data format.
For example, a visual might support 24-bit color, or 8-bit color,
and might expect pixels to be in a certain format.
</p>
<p>
Call <a href="../glib/glib-Doubly-Linked-Lists.html#g-list-free"><code class="function">g_list_free()</code></a> on the return value when you're finished with it.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>a list of visuals; the list must be freed, but not its contents</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best-depth"></a><h3>gdk_visual_get_best_depth ()</h3>
<pre class="programlisting"><a href="../glib/glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>                gdk_visual_get_best_depth           (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get the best available depth for the default GDK screen.  "Best"
means "largest," i.e. 32 preferred over 24 preferred over 8 bits
per pixel.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best available depth</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best-type"></a><h3>gdk_visual_get_best_type ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="returnvalue">GdkVisualType</span></a>       gdk_visual_get_best_type            (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Return the best available visual type for the default GDK screen.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best visual type</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-system"></a><h3>gdk_visual_get_system ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_visual_get_system               (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get the system'sdefault visual for the default GDK screen.
This is the visual for the root window of the display.
The return value should not be freed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>system visual</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best"></a><h3>gdk_visual_get_best ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_visual_get_best                 (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<p>
Get the visual with the most available colors for the default
GDK screen. The return value should not be freed.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best visual</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best-with-depth"></a><h3>gdk_visual_get_best_with_depth ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_visual_get_best_with_depth      (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> depth</code></em>);</pre>
<p>
Get the best visual with depth <em class="parameter"><code>depth</code></em> for the default GDK screen.
Color visuals and visuals with mutable colormaps are preferred
over grayscale or fixed-colormap visuals. The return value should not
be freed. <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> may be returned if no visual supports <em class="parameter"><code>depth</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>depth</code></em> :</span></p></td>
<td>a bit depth</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best visual for the given depth</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best-with-type"></a><h3>gdk_visual_get_best_with_type ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_visual_get_best_with_type       (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> visual_type</code></em>);</pre>
<p>
Get the best visual of the given <em class="parameter"><code>visual_type</code></em> for the default GDK screen.
Visuals with higher color depths are considered better. The return value
should not be freed. <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> may be returned if no visual has type
<em class="parameter"><code>visual_type</code></em>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>visual_type</code></em> :</span></p></td>
<td>a visual type</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best visual of the given type</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-best-with-both"></a><h3>gdk_visual_get_best_with_both ()</h3>
<pre class="programlisting"><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="returnvalue">GdkVisual</span></a> *         gdk_visual_get_best_with_both       (<em class="parameter"><code><a href="../glib/glib-Basic-Types.html#gint"><span class="type">gint</span></a> depth</code></em>,
                                                         <em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisualType" title="enum GdkVisualType"><span class="type">GdkVisualType</span></a> visual_type</code></em>);</pre>
<p>
Combines <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-depth" title="gdk_visual_get_best_with_depth ()"><code class="function">gdk_visual_get_best_with_depth()</code></a> and <a class="link" href="gdk-Visuals.html#gdk-visual-get-best-with-type" title="gdk_visual_get_best_with_type ()"><code class="function">gdk_visual_get_best_with_type()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>depth</code></em> :</span></p></td>
<td>a bit depth</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>visual_type</code></em> :</span></p></td>
<td>a visual type</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>best visual with both <em class="parameter"><code>depth</code></em> and <em class="parameter"><code>visual_type</code></em>, or <a href="../glib/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if none</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-ref"></a><h3>gdk_visual_ref()</h3>
<pre class="programlisting">#define gdk_visual_ref(v) g_object_ref(v)
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_visual_ref</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Deprecated equivalent of <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-ref"><code class="function">g_object_ref()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the same visual</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-unref"></a><h3>gdk_visual_unref()</h3>
<pre class="programlisting">#define gdk_visual_unref(v) g_object_unref(v)
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">gdk_visual_unref</code> is deprecated and should not be used in newly-written code.</p>
</div>
<p>
Deprecated equivalent of <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref"><code class="function">g_object_unref()</code></a>.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>v</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="gdk-visual-get-screen"></a><h3>gdk_visual_get_screen ()</h3>
<pre class="programlisting"><a class="link" href="GdkScreen.html" title="GdkScreen"><span class="returnvalue">GdkScreen</span></a> *         gdk_visual_get_screen               (<em class="parameter"><code><a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a> *visual</code></em>);</pre>
<p>
Gets the screen to which this visual belongs
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>visual</code></em> :</span></p></td>
<td>a <a class="link" href="gdk-Visuals.html#GdkVisual" title="GdkVisual"><span class="type">GdkVisual</span></a>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the screen to which this visual belongs.</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
</div>
<div class="refsect1">
<a name="gdk-Visuals.see-also"></a><h2>See Also</h2>
<p>
<a class="link" href="gdk-Images.html#GdkImage" title="GdkImage"><span class="type">GdkImage</span></a>, <a class="link" href="gdk-Colormaps-and-Colors.html#GdkColormap" title="GdkColormap"><span class="type">GdkColormap</span></a>, <span class="type">GdkRGB</span>
</p>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.17</div>
</body>
</html>